home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / tcplusx.zip / DEVICE.H < prev    next >
C/C++ Source or Header  |  1991-02-28  |  4KB  |  149 lines

  1. #ifndef _DEVICE_H
  2. #define _DEVICE_H
  3.  
  4. //
  5. // device.h     - header file for class Device
  6. // Author        - Robin W. McKean
  7. // Last Update    - February 19,1991
  8. // Copyright (C) 1991 All rights reserved
  9. //
  10. // This file remains the property of the author, Robin W. McKean.  You are
  11. // free to use and change it as you see fit.  This module, nor its object
  12. // code, may not however be included  in any packaged software without the
  13. // written consent of the author.
  14. //
  15.  
  16. // Contents ----------------------------------------------------------------
  17. //
  18. //        deviceClass
  19. //        Device
  20. //
  21. // Description
  22. //
  23. //        Defines the class Device.  The purpose of this class is to serve
  24. //        as an abstract class from which other devices can be built.
  25. //
  26. // End ---------------------------------------------------------------------
  27.  
  28. // Interface dependencies ---------------------------------------------------
  29.  
  30. #ifndef _IOSTREAM_H
  31. #include <iostream.h>
  32. #endif
  33.  
  34. #ifndef _GEN_H
  35. #include <gen.h>
  36. #endif
  37.  
  38. #ifndef _USETYPES_H
  39. #include <usetypes.h>
  40. #endif
  41.  
  42. #ifndef _OBJECT_H
  43. #include <object.h>
  44. #endif
  45.  
  46. #ifndef _EVENT_H
  47. #include <event.h>
  48. #endif
  49.  
  50. // End Interface dependencies ---------------------------------------------
  51.  
  52. // Implementation dependencies --------------------------------------------
  53.  
  54. #ifndef _EVENTMGR_H
  55. #include <eventmgr.h>
  56. #endif
  57.  
  58. // End Implementation dependencies ----------------------------------------
  59.  
  60. // Class //
  61.  
  62. class Device : public Object
  63. {
  64. public:
  65.     Device( int initStatus = D_ON );
  66.     Device( Device& );
  67.     ~Device( void ) {}
  68.  
  69.     classType        isA( ) const = 0;
  70.     char            *nameOf( ) const = 0;
  71.     hashValueType    hashValue( ) const;
  72.     int             isEqual( const Object& ) const;
  73.     void            printOn( ostream& ) const;
  74.  
  75.     virtual int     processA( Event& ) = 0;
  76.     virtual void    pollDevice( ) = 0;
  77.  
  78.     int status;
  79.     int type;
  80.  
  81.     EventManager    *theEventManager;
  82. };
  83.  
  84. // Description --------------------------------------------------------------
  85. //
  86. //        Defines the device class that will be used to gather input information
  87. //        and transform them into class Events for passing to various objects.
  88. //        This object cannot work without the event manager
  89. //
  90. //    Constructor
  91. //
  92. //        Device( int initStatus = D_ON )
  93. //
  94. //        Initializes the device, and determines its initial status
  95. //
  96. //        Device( Device& )
  97. //
  98. //        Copy constructor, copies one device into another
  99. //
  100. //    Destructor
  101. //
  102. //        ~Device()
  103. //
  104. //        Really serves no purpose, required by compiler
  105. //
  106. //    Member Functions
  107. //
  108. //        isA( )
  109. //
  110. //        Returns character class type deviceClass
  111. //
  112. //        nameOf( )
  113. //
  114. //        Returns a character representation of class, "Device"
  115. //
  116. //        hashValue( )
  117. //
  118. //        This device has no hash value, so it returns 0
  119. //
  120. //        isEqual( const Object& )
  121. //
  122. //        Determines if one device is equal to another
  123. //
  124. //        printOn( ostream& )
  125. //
  126. //        Prints the contents of the class in a logical fashion
  127. //
  128. //        processA( Event& )
  129. //
  130. //        Responsible for taking an event, and processing the contents if
  131. //        applicable to this device
  132. //
  133. //        pollDevice( )
  134. //
  135. //        Requests information from a device, and translated into an event
  136. //        which is fed directly into the event manager's queue.
  137. //
  138. //    Inherited Members
  139. //
  140. //        isSortable( )        inherited from Object
  141. //        isAssociation( )    inherited from Object
  142. //        operator new        inherited from Object
  143. //        firstThat( )        inherited from Object
  144. //        lastThat( )         inherited from Object
  145. //
  146. // End Description ----------------------------------------------------------
  147.  
  148. #endif    // _DEVICE_H //
  149.